<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //创建代码执行时的时间对象
    //     var time1 = new Date();
    //     console.log(time1);
    //     //Fri Jul 01 2022 12:00:40 GMT+0800 (中国标准时间)
    //     console.log(time1.getTime()); //返回时间戳
    //    //1656648040077
    //     console.log(Date.now()); //返回当前时间戳
    //     //1656648040077


        // console.log(time1.getHours()); //返回小时
        // //11
        // console.log(time1.getMinutes()); //返回分钟
        // //40
        // console.log(time1.getSeconds()); //返回秒
        // //20
        // console.log(time1.getMilliseconds()); //返回毫秒
        // //893

        // console.log(time1.getFullYear());//返回年份

        // console.log(time1.getMonth()); //返回月份


        // console.log(time1.getDay());  //返回周几

        // console.log(time1.getDate()); // 返回第几天
    

        //创建自定义时间对象
        // var time2 = new Date('6/7/2019 8:00:00');
        // console.log(time2)

        //getDate()
        

        var start_time = Date.now();
        for(var i = 0;i < 50 ; i++){
            console.log(i);
        }
        var end_time = Date.now();
        var time = end_time - start_time;
        console.log('该for循环花费了'+time/1000 +'s')

    </script>
</body>
</html>